﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
   		<meta http-equiv="X-UA-Compatible" content="IE=edge">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>我的信息</title>
		<!-- Bootstrap -->
    	<link href="../css/bootstrap.min.css" rel="stylesheet">
    	<link rel="stylesheet" href="../css/sticky-footer-navbar.css" />
    	<link rel="stylesheet" href="../css/common.css" />
    	<link rel="stylesheet" href="../css/userinfo.css" />
    	<link rel="stylesheet" href="../css/index.css" />
    	<link rel="stylesheet" href="../css/normalize.css">
    	<link rel="stylesheet" href="../css/style1.css" media="screen" type="text/css" />
		<!-- <link rel="stylesheet" href="../css/index.css" /> -->
    	<link rel="stylesheet" href="../css/normalize.css">
    	<link rel="stylesheet" href="../css/style1.css" media="screen" type="text/css" />
   <script src="../js/jquery.min.js"></script>
    	<style>
html, body { background: #000; margin: 0; padding:0;}
canvas { width: 100%; height: 100%; position: absolute; }


</style>
	</head>
	<body>
	<canvas></canvas>
<script>
$(function(){
  var canvas = document.querySelector('canvas'),
      ctx = canvas.getContext('2d')
  canvas.width = window.innerWidth;
  canvas.height = window.innerHeight;
  ctx.lineWidth = .3;
  ctx.strokeStyle = (new Color(150)).style;

  var mousePosition = {
    x: 30 * canvas.width / 100,
    y: 30 * canvas.height / 100
  };

  var dots = {
    nb: 750,
    distance: 50,
    d_radius: 100,
    array: []
  };

  function colorValue(min) {
    return Math.floor(Math.random() * 255 + min);
  }
  
  function createColorStyle(r,g,b) {
    return 'rgba(' + r + ',' + g + ',' + b + ', 0.8)';
  }
  
  function mixComponents(comp1, weight1, comp2, weight2) {
    return (comp1 * weight1 + comp2 * weight2) / (weight1 + weight2);
  }
  
  function averageColorStyles(dot1, dot2) {
    var color1 = dot1.color,
        color2 = dot2.color;
    
    var r = mixComponents(color1.r, dot1.radius, color2.r, dot2.radius),
        g = mixComponents(color1.g, dot1.radius, color2.g, dot2.radius),
        b = mixComponents(color1.b, dot1.radius, color2.b, dot2.radius);
    return createColorStyle(Math.floor(r), Math.floor(g), Math.floor(b));
  }
  
  function Color(min) {
    min = min || 0;
    this.r = colorValue(min);
    this.g = colorValue(min);
    this.b = colorValue(min);
    this.style = createColorStyle(this.r, this.g, this.b);
  }

  function Dot(){
    this.x = Math.random() * canvas.width;
    this.y = Math.random() * canvas.height;

    this.vx = -.5 + Math.random();
    this.vy = -.5 + Math.random();

    this.radius = Math.random() * 2;

    this.color = new Color();
    console.log(this);
  }

  Dot.prototype = {
    draw: function(){
      ctx.beginPath();
      ctx.fillStyle = this.color.style;
      ctx.arc(this.x, this.y, this.radius, 0, Math.PI * 2, false);
      ctx.fill();
    }
  };

  function createDots(){
    for(i = 0; i < dots.nb; i++){
      dots.array.push(new Dot());
    }
  }

  function moveDots() {
    for(i = 0; i < dots.nb; i++){

      var dot = dots.array[i];

      if(dot.y < 0 || dot.y > canvas.height){
        dot.vx = dot.vx;
        dot.vy = - dot.vy;
      }
      else if(dot.x < 0 || dot.x > canvas.width){
        dot.vx = - dot.vx;
        dot.vy = dot.vy;
      }
      dot.x += dot.vx;
      dot.y += dot.vy;
    }
  }

  function connectDots() {
    for(i = 0; i < dots.nb; i++){
      for(j = 0; j < dots.nb; j++){
        i_dot = dots.array[i];
        j_dot = dots.array[j];

        if((i_dot.x - j_dot.x) < dots.distance && (i_dot.y - j_dot.y) < dots.distance && (i_dot.x - j_dot.x) > - dots.distance && (i_dot.y - j_dot.y) > - dots.distance){
          if((i_dot.x - mousePosition.x) < dots.d_radius && (i_dot.y - mousePosition.y) < dots.d_radius && (i_dot.x - mousePosition.x) > - dots.d_radius && (i_dot.y - mousePosition.y) > - dots.d_radius){
            ctx.beginPath();
            ctx.strokeStyle = averageColorStyles(i_dot, j_dot);
            ctx.moveTo(i_dot.x, i_dot.y);
            ctx.lineTo(j_dot.x, j_dot.y);
            ctx.stroke();
            ctx.closePath();
          }
        }
      }
    }
  }

  function drawDots() {
    for(i = 0; i < dots.nb; i++){
      var dot = dots.array[i];
      dot.draw();
    }
  }

  function animateDots() {
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    moveDots();
    connectDots();
    drawDots();

    requestAnimationFrame(animateDots);	
  }

  $('canvas').on('mousemove', function(e){
    mousePosition.x = e.pageX;
    mousePosition.y = e.pageY;
  });

  $('canvas').on('mouseleave', function(e){
    mousePosition.x = canvas.width / 2;
    mousePosition.y = canvas.height / 2;
  });

  createDots();
  requestAnimationFrame(animateDots);	
});
</script>
		<!--导航-->
		<nav class="navbar navbar-inverse  navbar-fixed-top" id="nav">
			<div class="container" id="nav_1">
				<nav class="navbar-header">
					<button class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<a href="${pageContext.request.contextPath }/index.jsp" class="navbar-brand">M-SS网上商城</a>
				</nav>
				<div class="collapse navbar-collapse" id="myNavbar" id="myNavbar">
					<ul class="nav navbar-nav">
						<li class="active"><a href="${pageContext.request.contextPath }/index.jsp">首页</a></li>
						<li><a href="#">功能1</a></li>
						<li><a href="#">功能2</a></li>
						<li><a href="#">功能3</a></li>
						<li><a href="#">功能4</a></li>
					</ul>
					<ul class="nav navbar-nav navbar-responsive-collapse navbar-right">
						<li>
							<a href="#" class="dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-user"></span> <c:if test="${MyUser eq null }">我的账户</c:if><c:if test="${MyUser ne null }">${MyUser.username }</c:if> <span class="caret"></span></a>
							<c:if test="${MyUser eq null }">
								<ul class="dropdown-menu dropdown-menu-left">
						        	<li><a href="${pageContext.request.contextPath }/login.jsp">登录</a></li>
						        	<li><a href="${pageContext.request.contextPath }/register.jsp">注册</a></li>   
					          	</ul>
				          	</c:if>
				          	<c:if test="${MyUser ne null }">
					          	<ul class="dropdown-menu dropdown-menu-left">
						        	<li><a href="${pageContext.request.contextPath }/user/userinfo.jsp">我的信息</a></li>
						        	<li><a href="${pageContext.request.contextPath }/user/order.jsp">我的订单</a></li>   
						        	<li><a href="${pageContext.request.contextPath }/exitServlet">退出</a></li>   
					          	</ul>
			          		</c:if>
						</li>
						<li>
							<a href="${pageContext.request.contextPath }/user/shopping.jsp"><span class="glyphicon glyphicon-shopping-cart"></span> 购物车</a>
						</li>
					</ul>
					<form class="navbar-form navbar-right hidden-sm">
						<div class="form-group">
							<input class="form-control" type="text" placeholder="搜索商品"  id="serch"/>
						</div>
						 <button type="submit" class="btn btn-success">搜索</button>
					</form>
		     	</div>
			</div>
		</nav>
		<!--导航-->
		
		<div class="container" style="margin-top: 51px;" id="userinfo">
			<div class="row">
				<div class="col-sm-3 touxiang1" style="padding: 20px;" >
					<div class="well touxiang2">
						<img class="img-responsive img-circle  " src="../image/button.jpg" alt=""  alt="Bird"/>
					<ul class="nav nav-pills nav-stacked h4 " style="margin-top: 20px;">
						<li id="li"><a href=""><span class="btbk1">我的信息</span></a></li>
						<li id="li" ><a href="javascript:void(0);" id="btn_infp" ><span class="btbk1">修改信息</span></a></li>
						<li id="li"><a href="javascript:void(0);" id="btn_pass" ><span class="btbk1">修改密码</span></a></li>
						<li id="li"><a href="javascript:void(0);" id="btn_address" ><span class="btbk1">收货地址</span></a></li>
					</ul>
					</div>
				</div>
				<div class="col-sm-9" style="padding: 20px;">
						<div class="panel panel-success" id="quan">
							<div class="panel-heading" id="biao">
								个人信息
							</div>
							<div class="panel-body">
								<table class="table table-bordered">
									<tr class="info">
										<th>用户名</th>
										<th>姓名</th>
										<th>性别</th>
										<th>联系电话</th>
										<th>收获地址</th>
									</tr>
									<tr class="warning">
										<td>${MyUser.username }</td>
										<td>${MyUser.realName }</td>
										<td>${MyUser.sex }</td>
										<td>${MyUser.telephone }</td>
										<td>${MyUser.address }</td>
									</tr>
								</table>
							</div>
						</div>
					<div id="MyInfo">
						<div class="panel panel-success" id="quan">
							<div class="panel-heading" id="biao">
								修改个人信息
							</div>
							<div class="panel-body">
								<form class="form-group" action="/M-SS/updateUserInfoServlet?flag=1" method="post">
									<div class="input-group">
										<div class="input-group-addon">
											<span class="glyphicon glyphicon-phone"></span>
										</div>
										<input class="form-control" name="realName" type="text" placeholder="请输入姓名" value="${MyUser.realName }"  id="serch"/>
									</div>
									<div class="h3">
										
										<input type="radio" name="sex" value="男"   <c:if test="${MyUser.sex eq '男'}">checked="checked"</c:if>   id="sex1"/>&nbsp;<label for="sex1"><span style="color:#fff">男</span></label>&nbsp;&nbsp;
										<input type="radio" name="sex"  value="女" <c:if test="${MyUser.sex eq '女'}">checked="checked"</c:if>   id="sex2"/>&nbsp;<label for="sex2"><span style="color:#fff">女</span></label>
									</div>
									<div class="input-group">
										<div class="input-group-addon">
											<span class="glyphicon glyphicon-phone"></span>
										</div>
										<input class="form-control" name="telephone" type="tel" placeholder="请输入电话号码" value="${MyUser.telephone }" id="serch"/>
									</div>
									<br />
									<div class="btn-group col-sm-12 center-block">
										<button class="btn btn-danger btn-lg btn-group-justified btbk" type="submit">修改信息</button>
									</div>
								</form>
							</div>
							
						</div>
					</div>
						<!--修改密码-->
						<div class="panel panel-success" id="modify_pass" style="display: none;" >
							<div class="panel-heading" id="biao">
								修改密码
							</div>
							<div class="panel-body">
								<form class="form-group" action="/M-SS/updateUserInfoServlet?flag=2" method="post">
									<div class="input-group">
										<div class="input-group-addon">
											<span class="glyphicon glyphicon-lock"></span>
										</div>
										<input class="form-control" type="password" name="password" placeholder="请输入原密码" id="serch"/>
									</div>
									<br />
									<div class="input-group">
										<div class="input-group-addon">
											<span class="glyphicon glyphicon-lock"></span>
										</div>
										<input class="form-control" type="text" name="newPass1" placeholder="新密码" id="serch"/>
									</div>
									<br />
									<div class="input-group">
										<div class="input-group-addon">
											<span class="glyphicon glyphicon-lock"></span>
										</div>
										<input class="form-control" type="text" name="newPass2" placeholder="确认密码" name="password" id="serch"/>
									</div>
									<br />
									<div class="btn-group col-sm-12 center-block">
										<input class="btn btn-danger btn-lg btn-group-justified btbk" type="submit" value="修改密码" />
									</div>
								</form>
							</div>
						</div>
						<!--修改密码-->
						<form action="/M-SS/updateUserInfoServlet?flag=3" method="post">
						<div class="panel panel-success" id="mode_address" style="display: none;">
							<div class="panel-heading" id="biao">
								收货地址
							</div>
							<div class="panel-body">
								<div class="col-sm-12" style="padding: 0 30px;">
									<textarea class="form-control" name="address" id="serch">${MyUser.address }</textarea>
								</div>
								<div class="col-sm-12" style="padding: 10px 30px 0 30px;">
									<button class="btn btn-lg btn-danger btn-success btn-group-justified btbk" type="submit" >修改地址</button>
								</div>
							</div>
								
						</div>
						</form>
				</div>
			</div>
		</div>
	
		<!--<div class="well bg-primary" style="height: 500px; margin-top: 51px;">
			
		</div>-->
	
		<footer class="container-fluid panel-footer text-center footer">
			<p>网上商城 Copyright</p>
		</footer>
		
		
   
	<!--内容-->
	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="../js/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="../js/bootstrap.min.js"></script>
        <script>
    	$(function() {
    		$("#btn_infp").click(function() {
    			$("#MyInfo").toggle("fast");
    			/* $("#MyInfo").hide("slow"); */
    		});
    		$("#btn_pass").click(function() {
    			$("#modify_pass").toggle("fast");
    			/* $("#MyInfo").hide("slow"); */
    		});
    		$("#btn_address").click(function() {
    			$("#mode_address").toggle("fast");
    			/* $("#MyInfo").hide("slow"); */
    		});
    	});
    </script>
	</body>
</html>
